package vsvm.gui.forms;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class AboutDialog extends JDialog {

	private JPanel jContentPane = null;
	private JPanel pnlButtons = null;
	private JButton btnOk = null;
	private JPanel pnlCenter = null;
	private JLabel lblAbout = null;
	/**
	 * This method initializes pnlButtons	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getPnlButtons() {
		if (pnlButtons == null) {
			FlowLayout flowLayout = new FlowLayout();
			flowLayout.setVgap(10);
			pnlButtons = new JPanel();
			pnlButtons.setLayout(flowLayout);
			pnlButtons.setPreferredSize(new java.awt.Dimension(45,45));
			pnlButtons.add(getBtnOk(), null);
		}
		return pnlButtons;
	}

	/**
	 * This method initializes btnOk	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnOk() {
		if (btnOk == null) {
			btnOk = new JButton();
			btnOk.setPreferredSize(new java.awt.Dimension(80,25));
			btnOk.setText("OK");
			btnOk.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					dispose();
				}
			});
		}
		return btnOk;
	}

	/**
	 * This method initializes pnlCenter	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getPnlCenter() {
		if (pnlCenter == null) {
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.gridx = 0;
			gridBagConstraints.gridy = 0;
			gridBagConstraints.insets = new java.awt.Insets(10,20,10,20);
			gridBagConstraints.weightx = 1.0;
			gridBagConstraints.weighty = 1.0;
			gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
			lblAbout = new JLabel();
			lblAbout.setText("<html>Visual MultiSVM<br><br>Version 1.0.0 <br><br>Created by: Vytenis Sakenas, Narunas Vaskevicius </html>");
			pnlCenter = new JPanel();
			pnlCenter.setLayout(new GridBagLayout());
			pnlCenter.add(lblAbout, gridBagConstraints);
		}
		return pnlCenter;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	/**
	 * This is the default constructor
	 */
	public AboutDialog(Frame parent) {
		super(parent);
		initialize();
		setLocationRelativeTo(parent);
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(300, 200);
		this.setTitle("About Visual MultiSVM");
		this.setResizable(false);
		this.setContentPane(getJContentPane());
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getPnlButtons(), java.awt.BorderLayout.SOUTH);
			jContentPane.add(getPnlCenter(), java.awt.BorderLayout.CENTER);
		}
		return jContentPane;
	}

}
